<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::middleware(['cors', 'api_log'])->group(function () {

    Route::group(['prefix' => 'videos'], function () {
        //全部视频列表
        Route::get('/', 'Api\VideoController@index');
        //指定频道视频列表
        Route::get('/channels/{channel_id}', 'Api\VideoController@indexByChannelId');
        //视频详情
        Route::get('/{id}', 'Api\VideoController@show');
    });

    Route::group(['prefix' => 'video_channels'], function () {
        //视频频道列表
        Route::get('/', 'Api\VideoChannelController@index');
    });
});

